/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.mobiubiq.directory.client.object.io;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.mobiubiq.directory.client.object.AbstractObject;
import org.mobiubiq.directory.client.object.LocationObject;

/**
 *
 * @author Marnix Renne
 */
class LocationObjectReaderWriter implements ObjectReaderWriter {

    public void write(AbstractObject object, DataOutputStream outputStream) throws IOException {
        LocationObject lo = (LocationObject) object;
        outputStream.writeDouble(lo.getLatitude());
        outputStream.writeDouble(lo.getLongitude());
    }

    public AbstractObject read(DataInputStream inputStream) throws IOException {
        LocationObject result = new LocationObject();
        result.setLatitude(inputStream.readDouble());
        result.setLongitude(inputStream.readDouble());
        return result;
    }
}
